use actix_web::web;

use crate::{
    config::get_max_count,
    database::{table, DbPool},
    route::form::image::{ImageForm, NewImageForm},
    service::{class, ServiceError},
    srv_adds, srv_dels, srv_get_all_by_foreign_key, srv_get_all_by_slug,
};

srv_adds!(add_images, NewImageForm, table::image::crud::creates);
srv_dels!(del_images, ImageForm, table::image::crud::deletes);

srv_get_all_by_foreign_key!(
    get_by_post_id,
    ImageForm,
    table::image::crud::read_count_from_offset_by_pid
);
srv_get_all_by_slug!(
    get_by_post_sid,
    ImageForm,
    class::post::get_by_sid,
    id,
    get_by_post_id
);
